import {request} from './request'

export function createOrder(params){
    return request({
        url:'/api/orders',
        method:'POST',
        params
    })
}

export function getOrderPreview(){
    return request({
        url:'/api/orders/preview',
    })
}

export function payOrder(order,params){
    return request({
        url:`/api/orders/${order}/pay`,
        params
    })
}

export function payOrderStatus(order){
    return request({
        url:'/api/orders/'+order+'/status',
    })
}

export function getOrderList(params){
    return request({
        url:'/api/orders',
        method:'GET',
        params
    })
}

export function getOrderDetail(order){
    return request({
        url:`/api/orders/${order}`,
        params:{
            include:'user,orderDetails.goods'
        }
    })
}

export function confirmOrder(order){
    return request({
        url:`/api/orders/${order}/confirm`,
        method:'PATCH'
    })
}


export function viewExpress(order){
    return request({
        url:`/api/orders/${order}/express`,
    })
}


